﻿@{
    Layout = "_mainLayout.cshtml";

  var pid = Request.QueryString[0];

  if(pid!=null)
  {
      
      if(pid.Length>0)
      {
          
          Session["pid"]=pid;
      }
  }

  var db = Database.Open("EPS");
  var row = db.QuerySingle("SELECT * FROM awaitingpoll WHERE pollid = '"+Session["pid"]+"'");

  var a = row.pollid.ToString();
  var b = row.desc.ToString();
  var c = row.op1.ToString();
  var d = row.op2.ToString();
  var e = row.op3.ToString();
  var f = row.agelimit.ToString();
  var g = row.pollcity.ToString();
  var h = row.pollcountry.ToString();
  var i = row.pollgender.ToString();
  var j = DateTime.Now;

  db.Close();
  

  

  if( IsPost && pid!= null) {
     
    var db1 = Database.Open("EPS");
    var insertQuery = "INSERT INTO approvedpoll VALUES ('"+a+" ','"+b+"','"+c+"','"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"','"+j+"')"; 
   
    db1.Execute(insertQuery);
    
    
    var deleteQueryString = "DELETE FROM awaitingpoll WHERE pollid='"+Session["pid"]+"'";
    


    db1.Execute(deleteQueryString, pid);
    Response.Redirect("~/PollsInbox.cshtml");
    
    
    db1.Close();

    
    
  }

    
}

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
         <div>
  <h1></br></br>Approve User - Confirmation</h1>
  <form method="post" action="" name="form">
    <p>Are you sure you want to approve this user?</p>
     
    <p>
       
    
    </p>

    <p><input type="submit" value="Approve" /></p>

    <a href="~/AwaitingUsers.cshtml" style="color: #0094ff">Go Back</a>
      
  </form>
    </div>

        
    </body>
</html>

